<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>API: profiler  YAHOO.tool.Profiler   (YUI Library)</title>
	<link rel="stylesheet" type="text/css" href="assets/api.css">
    <script type="text/javascript" src="assets/api-js"></script>
    <script type="text/javascript" src="assets/ac-js"></script>
</head>

<body id="yahoo-com">

<div id="doc3" class="yui-t2">

	<div id="hd">
        <a href="http://developer.yahoo.com/yui/"><h1>Yahoo! UI Library</h1></a>
        <h3>profiler&nbsp; <span class="subtitle">2.6.0</span></h3>
        <p>
        <a href="./index.html">Yahoo! UI Library</a> 
            &gt; <a href="./module_profiler.html">profiler</a>
                 &gt; YAHOO.tool.Profiler 
                
            </p>


	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">
            <form name="yui-classopts-form">
    <span id="classopts"><input type="checkbox" name="showprivate" id="showprivate" /> <label for="showprivate">Show Private</label></span>
    <span id="classopts"><input type="checkbox" name="showprotected" id="showprotected" /> <label for="showprotected">Show Protected</label></span>
    <span id="classopts"><input type="checkbox" name="showdeprecated" id="showdeprecated" /> <label for="showdeprecated">Show Deprecated</label></span>
            </form>

                    <h2>
                        

                        <code>static</code>
                        
                            Class <b>YAHOO.tool.Profiler</b>
                        <span class="extends">
                        </span>

                        <span class="extends">
                        </span>
                        
                        </code>
                    </h2>
                    <!-- class tree goes here -->
                    
                
  

                    <div class="summary description">
                        Profiles functions in JavaScript.
                    </div>


                        <div class="section field details">
                            <h3 id="properties">Properties</h3>
                            <div class="content">
                                    <div class="private">
                                    <h4><a name="property__container">_container</a>
                                        <code>- private static Object</code>
                                    </h4>
                                    <div class="detail">
                                        <div class="description">
                                            Container object on which to put the original unprofiled methods.
                                        </div>
                                    </div>
     
                                        


                                    <hr />
                                    </div>
                                    <div class="private">
                                    <h4><a name="property__report">_report</a>
                                        <code>- private static Object</code>
                                    </h4>
                                    <div class="detail">
                                        <div class="description">
                                            Call information for functions.
                                        </div>
                                    </div>
     
                                        


                                    <hr />
                                    </div>


                            </div>
                        </div>


                        <div class="section method details">
                            <h3 id="methods">Methods</h3>
                            <div class="content">
                                    <div class="private">
                                    <h4>
                                        <a name="method__saveData">_saveData</a></h4>
                                    <div class="detail">
                                        <code>
                                         private 
                                         static 
                                        
                                        Void
                                            <strong>_saveData</strong>
                                           (
                                                
                                                        
                                                         name
                                                    
                                                
                                                        , 
                                                         duration
                                                    
                                                
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Called when a method ends execution. Marks the start and end time of the 
method so it can calculate how long the function took to execute. Also 
updates min/max/avg calculations for the function.
                                        </div>

                                        <div class="description">

                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>name &lt;String&gt;</code>
                                                             The name of the function to mark as stopped.
                                                        </dd>
                                                        <dd>
                                                            <code>duration &lt;int&gt;</code>
                                                             The number of milliseconds it took the function to
execute.
                                                        </dd>
                                                </dl>

                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        Void
                                                    </code></dt>
                                                    <dd></dd>
                                                </dl>


             

                                        </div>

                                    </div>
                                    <hr />
                                    </div>
                                    <div class="">
                                    <h4>
                                        <a name="method_getAverage">getAverage</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                         static 
                                        
                                        float
                                            <strong>getAverage</strong>
                                           (
                                                
                                                        
                                                         name
                                                    
                                                
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Returns the average amount of time (in milliseconds) that the function
with the given name takes to execute.
                                        </div>

                                        <div class="description">

                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>name &lt;String&gt;</code>
                                                             The name of the function whose data should be returned.
If an object type method, it should be 'constructor.prototype.methodName';
a normal object method would just be 'object.methodName'.
                                                        </dd>
                                                </dl>

                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        float
                                                    </code></dt>
                                                    <dd>The average time it takes the function to execute.</dd>
                                                </dl>


             

                                        </div>

                                    </div>
                                    <hr />
                                    </div>
                                    <div class="">
                                    <h4>
                                        <a name="method_getCallCount">getCallCount</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                         static 
                                        
                                        int
                                            <strong>getCallCount</strong>
                                           (
                                                
                                                        
                                                         name
                                                    
                                                
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Returns the number of times that the given function has been called.
                                        </div>

                                        <div class="description">

                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>name &lt;String&gt;</code>
                                                             The name of the function whose data should be returned.
                                                        </dd>
                                                </dl>

                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        int
                                                    </code></dt>
                                                    <dd>The number of times the function was called.</dd>
                                                </dl>


             

                                        </div>

                                    </div>
                                    <hr />
                                    </div>
                                    <div class="">
                                    <h4>
                                        <a name="method_getFullReport">getFullReport</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                         static 
                                        
                                        Object
                                            <strong>getFullReport</strong>
                                           (
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Returns an object containing profiling data for all of the functions 
that were profiled. The object has an entry for each function and 
returns all information (min, max, average, calls, etc.) for each
function.
                                        </div>

                                        <div class="description">


                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        Object
                                                    </code></dt>
                                                    <dd>An object containing all profile data.</dd>
                                                </dl>


             

                                        </div>

                                    </div>
                                    <hr />
                                    </div>
                                    <div class="">
                                    <h4>
                                        <a name="method_getFunctionReport">getFunctionReport</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                         static 
                                        
                                        Object
                                            <strong>getFunctionReport</strong>
                                           (
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Returns an object containing profiling data for a single function.
The object has an entry for min, max, avg, calls, and points).
                                        </div>

                                        <div class="description">


                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        Object
                                                    </code></dt>
                                                    <dd>An object containing profile data for a given function.</dd>
                                                </dl>


             

                                        </div>

                                    </div>
                                    <hr />
                                    </div>
                                    <div class="">
                                    <h4>
                                        <a name="method_getMax">getMax</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                        
                                        
                                        float
                                            <strong>getMax</strong>
                                           (
                                                
                                                        
                                                         name
                                                    
                                                
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Returns the maximum amount of time (in milliseconds) that the function
with the given name takes to execute.
                                        </div>

                                        <div class="description">

                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>name &lt;String&gt;</code>
                                                             The name of the function whose data should be returned.
If an object type method, it should be 'constructor.prototype.methodName';
a normal object method would just be 'object.methodName'.
                                                        </dd>
                                                </dl>

                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        float
                                                    </code></dt>
                                                    <dd>The maximum time it takes the function to execute.</dd>
                                                </dl>


             

                                        </div>

                                    </div>
                                    <hr />
                                    </div>
                                    <div class="">
                                    <h4>
                                        <a name="method_getMin">getMin</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                        
                                        
                                        float
                                            <strong>getMin</strong>
                                           (
                                                
                                                        
                                                         name
                                                    
                                                
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Returns the minimum amount of time (in milliseconds) that the function
with the given name takes to execute.
                                        </div>

                                        <div class="description">

                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>name &lt;String&gt;</code>
                                                             The name of the function whose data should be returned.
If an object type method, it should be 'constructor.prototype.methodName';
a normal object method would just be 'object.methodName'.
                                                        </dd>
                                                </dl>

                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        float
                                                    </code></dt>
                                                    <dd>The minimum time it takes the function to execute.</dd>
                                                </dl>


             

                                        </div>

                                    </div>
                                    <hr />
                                    </div>
                                    <div class="">
                                    <h4>
                                        <a name="method_registerConstructor">registerConstructor</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                         static 
                                        
                                        Void
                                            <strong>registerConstructor</strong>
                                           (
                                                
                                                        
                                                         name
                                                    
                                                
                                                        , 
                                                         owner
                                                    
                                                
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Sets up a constructor for profiling, including all properties and methods on the prototype.
                                        </div>

                                        <div class="description">

                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>name &lt;string&gt;</code>
                                                             The fully-qualified name of the function including namespace information.
                                                        </dd>
                                                        <dd>
                                                            <code>owner &lt;Object&gt;</code>
                                                             (Optional) The object that owns the function (namespace or containing object).
                                                        </dd>
                                                </dl>

                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        Void
                                                    </code></dt>
                                                    <dd></dd>
                                                </dl>


             

                                        </div>

                                    </div>
                                    <hr />
                                    </div>
                                    <div class="">
                                    <h4>
                                        <a name="method_registerFunction">registerFunction</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                        
                                        
                                        Void
                                            <strong>registerFunction</strong>
                                           (
                                                
                                                        
                                                         name
                                                    
                                                
                                                        , 
                                                         owner
                                                    
                                                
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Sets up a function for profiling. It essentially overwrites the function with one
that has instrumentation data. This method also creates an entry for the function
in the profile report. The original function is stored on the _container object.
                                        </div>

                                        <div class="description">

                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>name &lt;String&gt;</code>
                                                             The full name of the function including namespacing. This
is the name of the function that is stored in the report.
                                                        </dd>
                                                        <dd>
                                                            <code>owner &lt;Object&gt;</code>
                                                             (Optional) The object that owns the function. If the function
isn't global then this argument is required. This could be the namespace that
the function belongs to, such as YAHOO.util.Dom, or the object on which it's
a method.
                                                        </dd>
                                                </dl>

                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        Void
                                                    </code></dt>
                                                    <dd></dd>
                                                </dl>


             

                                        </div>

                                    </div>
                                    <hr />
                                    </div>
                                    <div class="">
                                    <h4>
                                        <a name="method_registerObject">registerObject</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                         static 
                                        
                                        Void
                                            <strong>registerObject</strong>
                                           (
                                                
                                                        
                                                         name
                                                    
                                                
                                                        , 
                                                         owner
                                                    
                                                
                                                        , 
                                                         recurse
                                                    
                                                
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Sets up an object for profiling. It takes the object and looks for functions.
When a function is found, registerMethod() is called on it. If set to recrusive
mode, it will also setup objects found inside of this object for profiling, 
using the same methodology.
                                        </div>

                                        <div class="description">

                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>name &lt;String&gt;</code>
                                                             The name of the object to profile (shows up in report).
                                                        </dd>
                                                        <dd>
                                                            <code>owner &lt;Object&gt;</code>
                                                             (Optional) The object represented by the name.
                                                        </dd>
                                                        <dd>
                                                            <code>recurse &lt;Boolean&gt;</code>
                                                             (Optional) Determines if subobject methods are also profiled.
                                                        </dd>
                                                </dl>

                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        Void
                                                    </code></dt>
                                                    <dd></dd>
                                                </dl>


             

                                        </div>

                                    </div>
                                    <hr />
                                    </div>
                                    <div class="">
                                    <h4>
                                        <a name="method_unregisterFunction">unregisterFunction</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                        
                                        
                                        Void
                                            <strong>unregisterFunction</strong>
                                           (
                                                
                                                        
                                                         name
                                                    
                                                
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Removes a constructor function from profiling. Reverses the registerConstructor() method.
                                        </div>

                                        <div class="description">

                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>name &lt;String&gt;</code>
                                                             The full name of the function including namespacing. This
is the name of the function that is stored in the report.
                                                        </dd>
                                                </dl>

                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        Void
                                                    </code></dt>
                                                    <dd></dd>
                                                </dl>


             

                                        </div>

                                    </div>
                                    <hr />
                                    </div>
                                    <div class="">
                                    <h4>
                                        <a name="method_unregisterObject">unregisterObject</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                         static 
                                        
                                        Void
                                            <strong>unregisterObject</strong>
                                           (
                                                
                                                        
                                                         name
                                                    
                                                
                                                        , 
                                                         recurse
                                                    
                                                
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Unregisters an object for profiling. It takes the object and looks for functions.
When a function is found, unregisterMethod() is called on it. If set to recrusive
mode, it will also unregister objects found inside of this object, 
using the same methodology.
                                        </div>

                                        <div class="description">

                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>name &lt;String&gt;</code>
                                                             The name of the object to unregister.
                                                        </dd>
                                                        <dd>
                                                            <code>recurse &lt;Boolean&gt;</code>
                                                             (Optional) Determines if subobject methods should also be
unregistered.
                                                        </dd>
                                                </dl>

                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        Void
                                                    </code></dt>
                                                    <dd></dd>
                                                </dl>


             

                                        </div>

                                    </div>
                                    <hr />
                                    </div>
                            </div>
                        </div>







			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div class="module">
                        <h4>Modules</h4>
                        <ul class="content">

                                <li class=""><a href="module_animation.html">animation</a></li>

                                <li class=""><a href="module_autocomplete.html">autocomplete</a></li>

                                <li class=""><a href="module_button.html">button</a></li>

                                <li class=""><a href="module_calendar.html">calendar</a></li>

                                <li class=""><a href="module_carousel.html">carousel</a></li>

                                <li class=""><a href="module_charts.html">charts</a></li>

                                <li class=""><a href="module_colorpicker.html">colorpicker</a></li>

                                <li class=""><a href="module_connection.html">connection</a></li>

                                <li class=""><a href="module_container.html">container</a></li>

                                <li class=""><a href="module_cookie.html">cookie</a></li>

                                <li class=""><a href="module_datasource.html">datasource</a></li>

                                <li class=""><a href="module_datatable.html">datatable</a></li>

                                <li class=""><a href="module_dom.html">dom</a></li>

                                <li class=""><a href="module_dragdrop.html">dragdrop</a></li>

                                <li class=""><a href="module_editor.html">editor</a></li>

                                <li class=""><a href="module_element.html">element</a></li>

                                <li class=""><a href="module_event.html">event</a></li>

                                <li class=""><a href="module_get.html">get</a></li>

                                <li class=""><a href="module_history.html">history</a></li>

                                <li class=""><a href="module_imagecropper.html">imagecropper</a></li>

                                <li class=""><a href="module_imageloader.html">imageloader</a></li>

                                <li class=""><a href="module_json.html">json</a></li>

                                <li class=""><a href="module_layout.html">layout</a></li>

                                <li class=""><a href="module_logger.html">logger</a></li>

                                <li class=""><a href="module_menu.html">menu</a></li>

                                <li class=""><a href="module_paginator.html">paginator</a></li>

                                <li class="selected"><a href="module_profiler.html">profiler</a></li>

                                <li class=""><a href="module_profilerviewer.html">profilerviewer</a></li>

                                <li class=""><a href="module_resize.html">resize</a></li>

                                <li class=""><a href="module_selector.html">selector</a></li>

                                <li class=""><a href="module_slider.html">slider</a></li>

                                <li class=""><a href="module_tabview.html">tabview</a></li>

                                <li class=""><a href="module_treeview.html">treeview</a></li>

                                <li class=""><a href="module_uploader.html">uploader</a></li>

                                <li class=""><a href="module_yahoo.html">yahoo</a></li>

                                <li class=""><a href="module_yuiloader.html">yuiloader</a></li>

                                <li class=""><a href="module_yuitest.html">yuitest</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class="selected"><a href="YAHOO.tool.Profiler.html">YAHOO.tool.Profiler</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class=""><a href="Profiler.js.html">Profiler.js</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Properties</h4>
                        <ul class="content">        
                                <li class="private"><a href="#property__container">_container</a>
                                        <!--<code>&lt;Object&gt;</code>-->
                                </li>
                                <li class="private"><a href="#property__report">_report</a>
                                        <!--<code>&lt;Object&gt;</code>-->
                                </li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Methods</h4>
                        <ul class="content">        
                                <li class="private"><!--<code>Void</code>-->
                                <a href="#method__saveData">_saveData</a>
                                </li>
                                <li class=""><!--<code>float</code>-->
                                <a href="#method_getAverage">getAverage</a>
                                </li>
                                <li class=""><!--<code>int</code>-->
                                <a href="#method_getCallCount">getCallCount</a>
                                </li>
                                <li class=""><!--<code>Object</code>-->
                                <a href="#method_getFullReport">getFullReport</a>
                                </li>
                                <li class=""><!--<code>Object</code>-->
                                <a href="#method_getFunctionReport">getFunctionReport</a>
                                </li>
                                <li class=""><!--<code>float</code>-->
                                <a href="#method_getMax">getMax</a>
                                </li>
                                <li class=""><!--<code>float</code>-->
                                <a href="#method_getMin">getMin</a>
                                </li>
                                <li class=""><!--<code>Void</code>-->
                                <a href="#method_registerConstructor">registerConstructor</a>
                                </li>
                                <li class=""><!--<code>Void</code>-->
                                <a href="#method_registerFunction">registerFunction</a>
                                </li>
                                <li class=""><!--<code>Void</code>-->
                                <a href="#method_registerObject">registerObject</a>
                                </li>
                                <li class=""><!--<code>Void</code>-->
                                <a href="#method_unregisterFunction">unregisterFunction</a>
                                </li>
                                <li class=""><!--<code>Void</code>-->
                                <a href="#method_unregisterObject">unregisterObject</a>
                                </li>
                        </ul>
                    </div>



            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2008 Yahoo! Inc. All rights reserved.
	</div>
</div>
</body>
</html>
